﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Collections.Generic;

namespace RhythmComet.Particles
{
    public class ParticleCollection
    {
        ParticleVertex[] vertices;
        ParticleProperties[] properties;

        public ParticleCollection(int maxParticles)
        {
            this.vertices = new ParticleVertex[maxParticles];
            this.properties = new ParticleProperties[maxParticles];
        }

        public ParticleVertex[] Vertices
        {
            get { return vertices; }
        }

        public void Copy(int from, int to)
        {
            vertices[to] = vertices[from];
            properties[to] = properties[from];
        }

        public Vector3 GetPosition(int index)
        {
            return vertices[index].Position;
        }

        public void SetPosition(int index, Vector3 position)
        {
            vertices[index].Position = position;
        }

        public Color GetColor(int index)
        {
            return vertices[index].Color;
        }

        public void SetColor(int index, Color color)
        {
            vertices[index].Color = color;
        }

        public float GetSize(int index)
        {
            return vertices[index].PointSize;
        }

        public void SetSize(int index, float size)
        {
            vertices[index].PointSize = size;
        }

        public Vector3 GetVelocity(int index)
        {
            return properties[index].velocity;
        }

        public void SetVelocity(int index, Vector3 velocity)
        {
            properties[index].velocity = velocity;
        }

        public Vector3 GetAcceleration(int index)
        {
            return properties[index].acceleration;
        }

        public void SetAcceleration(int index, Vector3 acceleration)
        {
            properties[index].acceleration = acceleration;
        }

        public float GetLifeTime(int index)
        {
            return properties[index].lifeTime;
        }

        public void SetLifeTime(int index, float lifetime)
        {
            properties[index].lifeTime = lifetime;
        }

        public float GetRotation(int index)
        {
            return properties[index].rotation;
        }

        public float GetRotationSpeed(int index)
        {
            return properties[index].rotationSpeed;
        }

        public void SetRotationSpeed(int index, float rotationSpeed)
        {
            properties[index].rotationSpeed = rotationSpeed;
        }

        public float GetTimeSinceStart(int index)
        {
            return properties[index].timeSinceStart;
        }

        public void SetTimeSinceStart(int index, float timeSinceStart)
        {
            properties[index].timeSinceStart = timeSinceStart;
        }
    }
}
